<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <script type="text/javascript" src="./js/jquery.min.js"></script>
    <title>修改学生</title>
</head>
<style>
    .layui-form{
        height: 250px;
       padding-top: 20px;
    }
    .buttonOne{
       width: 50%;
       height: 40px;
       margin-top: 80px;
       padding-left: 40%;
    }
    .buttonOne button{
        margin-left: 10px;
    }
    .layui-input, .layui-textarea{
        width: 70%;
    }
    .layui-form-label{
        padding: 9px 30px;
    }
    .layui-form-select .layui-edge{
      right: 30%;
    }
    .layui-form-select dl{
        min-width: 70%;
        left: 30px;
    }
  
</style>
<body>
    <form class="layui-form" action="" id="form">
            <div class="layui-form-item">
                <label class="layui-form-label">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</label>
                <div class="layui-input-block">
                    <input type="text" name="stu_name" value="${Student.stu_name}" required  lay-verify="required" placeholder="请输入学生姓名" autocomplete="off" class="layui-input stu_name">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</label>
                <div class="layui-input-block">
                    <input type="text" name="stu_number" value="${Student.stu_number}" required  lay-verify="required" placeholder="请输入学号" readonly="readonly" autocomplete="off" class="layui-input stu_number">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">班级编号</label>
                <div class="layui-input-block">
                  <select name="cl_id" lay-verify="required">
		                <c:forEach items="${items}" var="item">
		                	<option value=""></option>
			            	<option value="${item.class_name}">${item.class_name}</option>	
			            </c:forEach>                        
	              </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别</label>
                <div class="layui-input-block stu_sex">
                    <input type="radio" name="stu_sex" value="男" title="男">
                    <input type="radio" name="stu_sex" value="女" title="女" checked>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">出生日期</label>
                <div class="layui-input-block">
                    <input type="date" id="borrowtimebox" name="birth" value="${Student.birth}"
                        class="layui-input" placeholder="请输入">
                </div>
            </div>
            <span id="testView"></span>
            <div class="layui-form-item">
                <label class="layui-form-label">国&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;籍</label>
                <div class="layui-input-block">
                    <input type="text" name="nationality" value="${Student.nationality}" required  lay-verify="required" placeholder="请输入国籍" autocomplete="off" class="layui-input nationality">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">身份证号</label>
                <div class="layui-input-block">
                    <input type="text" name="stu_identifyID" value="${Student.stu_identifyID}" required  lay-verify="required" placeholder="请输入身份证" autocomplete="off" class="layui-input stu_identifyID">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">政治面貌</label>
                <div class="layui-input-block">
                  <select name="palitical" lay-verify="required">
                    <option value=""></option>
                    <option value="无">无</option>
                    <option value="共青团员">共青团员</option>
                    <option value="党员">党员</option>
                  </select>
                </div>
              </div>
            <div class="layui-form-item">
                <label class="layui-form-label">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址</label>
                <div class="layui-input-block">
                    <input type="text" name="source" value="${Student.source}" required  lay-verify="required" placeholder="请输入家庭地址" autocomplete="off" class="layui-input source">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话</label>
                <div class="layui-input-block">
                    <input type="text" name="stu_phone" value="${Student.stu_phone}" required  lay-verify="required" placeholder="请输入联系电" autocomplete="off" class="layui-input stu_phone">
                </div>
            </div>
            <div class="layui-form-item">
            
                <div class="layui-input-block buttonOne">
                    <button class="layui-btn btn" lay-submit lay-filter="formDemo" >立即提交</button>
                    <button type="reset" class="layui-btn layui-btn layui-btn-warm">重置</button>
                </div>
            </div>
    </form>
</body>
<script>
    layui.use('form','laydate',function(){
        var form=layui.form;
        var laydate=layui.laydate;
    
        laydate.render({
            elem:'#borrowtimebox'
        });

       
    });
    $(function () {       
		$(".btn").click( function () {
			var url="${pageContext.request.contextPath}/stuUpdate";
			var param=$("#form").serialize();
			param= decodeURIComponent(param,true);
			$.post(url,param,function(data){
			 	if(data.flag==0){
					alert(data.msg);
				}
				if(data.flag==1){
					window.parent.location.reload();//刷新父页面
			        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
			        parent.layer.close(index);
			        alert(data.msg);
				} 
			});
		});
    });
 
</script>
</html>